<?php
/**
 * Created by PhpStorm.
 * Admininfo: Administrator
 * Date: 2018/3/22
 * Time: 13:36
 */
namespace app\admin\controller;
use app\common\controller\Curt;
use think\Db;
class Riderremark extends Curt {
    public function getall()
    {
        $keyword=trim(input('get.keyword'));
        $where['c.rider_status']=1;//骑手状态正常  2为黑名单
        $where['a.r_display']=1;//评论状态 1.正常 2 隐藏
        if($keyword){
            $where['c.realname']=['like','%'.$keyword.'%'];//模糊查询or可以一个条件中写多个字段以‘|’分开
        }
        $rider=Db::name('riderremark')->alias('a')
            ->join('ec_user b','a.r_uid=b.id','left')
            ->join('ec_rider c','a.r_riderid=c.id','left')
            ->join('ec_orderinfo d','a.r_order=d.id','left')
            ->where($where)
            ->field('a.*,b.user_nickname,c.realname,c.phone,d.o_number')
            ->order('a.id desc')
            ->paginate();
        $riders=$rider->toArray();
        $page = $rider->render();
        /*$r_display=new \app\admin\model\Riderremark();
        $r_displays=$r_display->getdispaly();
        foreach($riders['data'] as $k=>$v){
            $riders['data'][$k]['r_display']=$r_displays[$v['r_display']]; //显示or隐藏
        }*/
        $this->assign(
            ['riders'=>$riders['data']],
            ['page'=>$page]
        );
    }

}